package com.ht.medicaltreatment.adapter

import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.TransportRfidSampleBox

class OrderDetailAdapter : BaseQuickAdapter<TransportRfidSampleBox,BaseViewHolder>(R.layout.item_detail_layout){
    override fun convert(holder: BaseViewHolder, item: TransportRfidSampleBox) {
       val recyclerView = holder.getView<RecyclerView>(R.id.recyclerView)
        recyclerView.layoutManager = GridLayoutManager(context,item.structureCol)

        val name = holder.getView<TextView>(R.id.tvName)
        val status = holder.getView<TextView>(R.id.tvState)
        name.text = item.name
        if(item.transportStatus == 0){
            status.text = "未盘点"
            status.setTextColor(context.getColor(R.color.color97))
            name.setTextColor(context.getColor(R.color.color97))
            recyclerView.setBackgroundResource(R.drawable.shape_recyclerview_gray)
            recyclerView.adapter = OrderItemAdapter(item.sampleVOList!!,false)
        }else{
            status.text = "已盘点"
            status.setTextColor(context.getColor(R.color.blue))
            name.setTextColor(context.getColor(R.color.blue))
            recyclerView.setBackgroundResource(R.drawable.shape_recyclerview_blue)
            recyclerView.adapter = OrderItemAdapter(item.sampleVOList!!,true)
        }
    }

}
